package com.example.bbs.domain.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.util.Date;
import java.util.Map;

@Data
public class User {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String userId;
    private String password;
    private String salt;
    private String nickName;
    private String avatar;
    private Date createTime;
    private Date updateTime;
    private Integer type;

    public static User parseMap(Map entries) {
        return JSONObject.parseObject(JSONObject.toJSONString(entries), User.class);
    }


    public static Map<String, Object> parseEntry(User user) {
        return JSONObject.parseObject(JSONObject.toJSONString(user), Map.class);
    }

}
